<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<link type="text/css" rel="stylesheet" href="css/dth.css" />

	<style>
</style>

</h:head>

<h:body>

	<h:panelGroup id="dlgisert2">
		<div class="feild-input"
			style="width: 136px !important; margin-right: 5px;">

			<h:outputLabel style="width:100% !important;"
				value="Choose user type"></h:outputLabel>
		</div>
		<h:form>
			<p:selectOneMenu value="#{accountBean.userType}" style="width:215px;">
				<f:selectItem itemLabel="Choose user type" itemValue="0"></f:selectItem>
				<f:selectItem itemLabel="User" itemValue="4"></f:selectItem>
				<f:selectItem itemLabel="Dealer" itemValue="2"></f:selectItem>
				<f:selectItem itemLabel="Distributor" itemValue="3"></f:selectItem>
				<p:ajax event="change" listener="#{accountBean.onChangeCbxUserType}"
					update=":user_type_list"></p:ajax>
			</p:selectOneMenu>
		</h:form>
		<h:panelGroup id="user_type_list">
			<h:form>
				<p:selectOneMenu value="#{accountBean.userId}"
					style="width:215px;margin-top:5px;">
					<f:selectItem itemLabel="Choose user account" itemValue="0"></f:selectItem>
					<f:selectItems value="#{accountBean.listUser}"></f:selectItems>
					<p:ajax event="change" listener="#{accountBean.onChangeCbxUserId}"></p:ajax>

				</p:selectOneMenu>
			</h:form>
		</h:panelGroup>
		<h:form>
			<div class="feild-input">
				<h:outputLabel value="#{msg['login_username']}"></h:outputLabel>
				<h:inputText value="#{accountBean.userName}" style="width:200px;">
					<p:ajax event="keyup" update="mess_username222"></p:ajax>
				</h:inputText>
			</div>
			<div class="feild-input">
				<h:outputText id="mess_username222"
					value="#{accountBean.messExistUsername}"></h:outputText>
			</div>
			<div class="feild-input">
				<h:outputLabel value="#{msg['login_password']}"></h:outputLabel>
				<p:password value="#{accountBean.password}" style="width:200px;" />
			</div>
			<div class="feild-input">
				<h:outputLabel value="Repeat password"></h:outputLabel>
				<p:password value="#{accountBean.rePassword}" style="width:200px;" />
			</div>
			<div class="feild-action">
				<p:commandButton value="#{msg['btn_ok']}" oncomplete="dlg2.hide()"
					action="#{accountBean.insertWithAdminRole}"
					update=":mainform,:growl"></p:commandButton>
				<p:commandButton value="#{msg['btn_cancel']}"
					oncomplete="dlg2.hide()"></p:commandButton>
			</div>
		</h:form>
	</h:panelGroup>

</h:body>
</html>